<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>假设一个存储整数的二维数组</title>
</head>

<body>
  <script>
    const arr = [
      [21, 32, 53, 31, 35, 43, 66],
      [42, 32, 53, 52, 86, 51, 66]
    ]
    let flatArr = arr.flat(); // 将二维数组转换为一维数组
    console.log(flatArr)

    var hash = [];
    for (var i = 0; i < flatArr.length; i++) {
      // 首次出现的位置
      if (hash.indexOf(flatArr[i]) == -1) {
        hash.push(flatArr[i]);
      }
    }
    console.log(hash)

  </script>
</body>

</html>